package org.keyintegrity.webbeans;

import static java.text.MessageFormat.format;

public class BeanEditorPoolHelper {

    public static void main(String[] args) {
        StringBuffer nestedBeanEditorTemplate = new StringBuffer();

        String formatPattern;
        if (args.length > 0 && args[0].equals("XsltBeanEditorPool")) {
            formatPattern = 
                "<span jwcid=\"block{0}@Block\">\n"
                + "\t<span jwcid=\"xbe{0}@XsltBeanEditor\" "
                +     "bean=\"ognl:components.block{0}.getParameter(''bean'')\" "
                +     "readOnly=\"ognl:components.block{0}.getParameter(''readOnly'')\" "
                +     "stylesheet=\"ognl:components.block{0}.getParameter(''stylesheet'')\" "
                +     "parent=\"ognl:components.block{0}.getParameter(''parent'')\" "
                +     "debugXml=\"ognl:components.block{0}.getParameter(''debugXml'')\" />\n"
                + "</span>\n"; 
        } else {
            formatPattern = 
                "<span jwcid=\"block{0}@Block\">\n"
                + "\t<span jwcid=\"be{0}@BeanEditor\" "
                +     "bean=\"ognl:components.block{0}.getParameter(''bean'')\" "
                +     "parent=\"ognl:components.block{0}.getParameter(''parent'')\" "
                +     "readOnly=\"ognl:components.block{0}.getParameter(''readOnly'')\" />\n"
                + "</span>\n"; 
        }
        
        for (int i = 0; i < 100; i++) {
            nestedBeanEditorTemplate.append( 
                format(formatPattern, i));
        }
        
        System.out.println(nestedBeanEditorTemplate.toString());
    }

}
